package com.xwaf.platform.web.controller.x;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.xwaf.platform.common.api.CommonResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;

@ApiIgnore
@RestController
@RequestMapping("/shiro")
@Api(hidden = true)
public class ShiroController {

	@ApiOperation(value = "shiro test")
	@RequiresPermissions("test") // 通過
	@ResponseBody
	@GetMapping(value = "/test", produces = "application/json;charset=UTF-8")
	public CommonResponse test() {
		return CommonResponse.createCommonResponse();
	}

	@ApiOperation(value = "shiro no test")
	@RequiresPermissions("no:test") // 不通過
	@ResponseBody
	@GetMapping(value = "/notest", produces = "application/json;charset=UTF-8")
	public CommonResponse notest() {
		return CommonResponse.createCommonResponse();
	}
}
